package com.hmkj.core.api.juhe.bean.epay;

/**
 * Description: 网银支付（CSPAY）返回状态码参数 Succeed 对应消息
 * Created by shiyaxiang on 2017/1/3 16:39.
 */
public enum CsPayErrCode {

    SUCCESS(88,"付款成功"),
    ORDER_NO_ERR(-1,"订单号错误"),
    TRADE_FAILED(0,"交易失败"),
    REPEAT_IP(5,"同一 ip重复交易"),
    REPEAT_COOKIE(8,"同一 cookie重复交易"),
    NOT_EXISTS_MERNO(10,"不存在该商户号"),
    MD5KEY_NOT_EXISTS(11,"MD5key不存在"),
    MD5_SIGNATURE_FAILED(13,"MD5 验签失败"),
    NO_REGISTER_URL(14,"交易网址未注册"),
    NO_OPEN_MERNO(15,"商户未开通"),
    NO_OPEN_CHANNEL(16,"通道未开通"),
    NO_BIND_NOTIFY_URL(16,"返回地址未绑定"),
    REPEAT_ORDER_NO(16,"交易流水号重复"),
    AMOUNT_ERR(16,"订单金额有误"),
    OUT_LIMITED(16,"当天金额超过限制"),
    WAIT_HANDLE(16,"待处理");

    private int state;

    private String stateinfo;

    CsPayErrCode(int state ,String stateinfo){
        this.state = state;
        this.stateinfo = stateinfo;
    }

    public int getState(){
        return state;
    }

    public String getStateinfo(){
        return stateinfo;
    }

    public static CsPayErrCode stateOf(int index){
        for (CsPayErrCode state : values()) {
            if(state.getState() == index){
                return state;
            }
        }
        return null;
    }
}
